using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

using YoYoMooc.StudentManagement.Models;
using YoYoMooc.StudentManagement.Services;

namespace YoYoMooc.StudentManagement.RazorPage.Pages.ViewComponents
{
    public class HeadCountViewComponent : ViewComponent
    {
        private readonly IStudentRepository _studentRepository;

        public HeadCountViewComponent(IStudentRepository studentRepository)
        {
            this._studentRepository = studentRepository;
        }

        public IViewComponentResult Invoke(MajorEnum? Major = null)
        {
           var result = _studentRepository.StudentCountByMajorEnum(Major);
            return View(result);
        }


//        public async Task<IViewComponentResult> InvokeAsync()
//        {
////  var result = studentRepository.StudentCountByMajorEnum();
//            return View(result);
//        }
    }
}